#
# @lc app=leetcode.cn id=119 lang=python3
#
# [119] 杨辉三角 II
#

# @lc code=start
class Solution:
    def getRow(self, rowIndex: int) -> List[int]:
        res = []
        for n in range(rowIndex + 1):
            row = [None for _ in range(n + 1)]
            row[0], row[-1] = 1, 1
            for j in range(1, len(row) - 1):
                row[j] = res[n - 1][j - 1] + res[n - 1][j]
            res.append(row)
        return res[-1]

# @lc code=end

